#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a, b, c;
ll ans;

bool f(int x) {
    return x % a != 0 && x % b != 0 && x % c != 0;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    cin >> a >> b >> c;
    for (int i = 1; i <= n; i++) {
        if (f(i)) ans++;
    }
    cout << ans << '\n';
    return 0;
}